<?php
/**
 *  The order of searching for template files:
 *  - site templates directory (lib/templates), "moduleName-tplName"
 *  - current module
 *  - parent module, parent of parent etc
 *  See the $templatePath variable
 *
 */
abstract class Yz_Template_Native
    extends Yz_Template_Abstract
    implements Yz_Template_Interface
{

    const TEMPLATE_TYPE = 'php';

    protected $boundaryMark = "\n<!-- %{BEGIN} %{class} -->\n";


    /**************************************
     *      Public methods            *
     **************************************/


    /**************************************
     *      Protected methods            *
     **************************************/

    protected function doRender()
    {
        debug();

        $file = $this->getFile();
        $bm = $this->boundaryMark;
        extract($this->value, EXTR_PREFIX_ALL, 'var');
        ob_start();
        if (null !== $bm) {
            $class = $this->className();
            print Yz_String::replaceVars($bm,array(
                'BEGIN' => 'BEGIN',
                'class' => $class,
                ));
        }
        include("$file");
        if (null !== $bm) {
            print Yz_String::replaceVars($bm,array(
                'BEGIN' => 'END',
                'class' => $class,
                ));
        }
        return ob_get_clean();
    }


}
